package com.zhihao.zhihaopicturebackend.model.dto.user;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;

@ApiModel(description = "用户注册请求类")
@Data
public class UserRegisterRequest implements Serializable {

    /**
     * 账号
     */
    @ApiModelProperty(value = "用户账号(仅能包含数字、字母、下划线'_'，长度必须在4-20个字符之间)", required = true, example = "zhihao_186")
    @NotBlank(message = "用户账号不能为空")
    @Pattern(regexp = "^[a-zA-Z0-9_]{4,30}$", message = "用户账号仅能包含数字、字母、下划线'_'")
    @Size(min = 4, max = 30, message = "用户账号长度必须在4-20个字符之间")
    private String userAccount;

    /**
     * 密码
     */
    @ApiModelProperty(value = "密码(长度必须在8到20个字符之间)", required = true)
    @NotBlank(message = "密码不能为空")
    @Size(min = 8, max = 20, message = "密码长度必须在8-20个字符之间")
    private String userPassword;

    /**
     * 确认密码
     */
    @ApiModelProperty(value = "校验密码(必须与密码保持一致)", required = true)
    @NotBlank(message = "确认密码不能为空")
    @Size(min = 8, max = 20, message = "确认密码长度必须在8-20个字符之间")
    private String checkPassword;

    private static final long serialVersionUID = 3191241716373120793L;
}
